package demo7;

public class Test {
    public static void main(String[] args) {
        String str = "NIwUOy";
        toChage(str);
    }
    public static void toChage(String str) {
        int size = str.length() - 1;
        StringBuffer stringBuffer = new StringBuffer("");
        for (int i = size; i >= 0; i--) {
            String s = str.charAt(i)+"";
            // 返回1 就是小写 否则就是大写
            if (judge(str.charAt(i)) == 1) {
                stringBuffer.append(s.toUpperCase());
            } else {
                stringBuffer.append(s.toLowerCase());
            }
        }
        System.out.println(stringBuffer.toString());
    }


    //判断字符  返回1 就是小写  返回0 就是大写
    public static int judge(char ch) {
        if (ch >= 'a' && ch <= 'z') {
            return 1;
        }
        return 0;
    }
}
